//
//  ZH_HomeTopTitleTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/17.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_HomeTopTitleTableViewCell.h"
@interface ZH_HomeTopTitleTableViewCell()
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UIButton *rightButton;
@end
@implementation ZH_HomeTopTitleTableViewCell

///创建
+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_HomeTopTitleTableViewCell";
    ZH_HomeTopTitleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_HomeTopTitleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
///初始化
-(void)initDefault
{
    [self unShowClickEffect];
    self.bottomShortLineImage.hidden = NO;
}
- (void)setTitleString:(NSString *)titleString{
    self.titleLabel.text = titleString;
}
- (void)loadSubviewConstraints{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(16));
        make.center.equalTo(self.contentView);
    }];
    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView).offset(FITSCALE(-22));
    }];
}
#pragma mark - getter,setter
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [UILabel createLabelWithText:@"" font:kFontSize_30];
        label.font = [UIFont boldSystemFontOfSize:15];
        [self.contentView addSubview:_titleLabel = label];
    }
    return _titleLabel;
}
- (UIButton *)rightButton{
    if (!_rightButton) {
        UIButton *button = [UIButton createNoBgButtonWithTitle:@"更多>" target:self action:nil];
        [button setTitleColor:[UIColor colorWithHexString:@"#999999"] forState:UIControlStateNormal];
        [self.contentView addSubview:_rightButton = button];
    }
    return _rightButton;
}
@end
